import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:wangziyi/pages/app_my/app_seting/app_seting_view.dart';
import 'package:wangziyi/widget/BottomClipper.dart';

import 'app_my_logic.dart';
import 'app_my_state.dart';

class AppMyPage extends StatelessWidget {
  final AppMyLogic logic = Get.put(AppMyLogic());
  final AppMyState state = Get.find<AppMyLogic>().state;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      // backgroundColor: Colors.transparent,
      appBar: AppBar(
        toolbarHeight: 0,
        elevation: 0,
        backgroundColor: Colors.pink,
      ),
      body: Container(
        child: ClipPath(
          clipper: BottomClipper(),
          child: Container(
            height: Get.size.height / 5,
            color: Colors.pink,
            child: Column(
              children: <Widget>[
                //头像、昵称、个性签名
                ListTile(
                    leading: ClipOval(
                        child: Image.asset('assets/images/touxiang.png')),
                    title: Text('wangziyi',
                        maxLines: 1,
                        style: TextStyle(
                            fontSize: 20, fontWeight: FontWeight.w900)),
                    subtitle: Text('我就是我，不一样的烟火', maxLines: 1),
                    trailing: GestureDetector(
                        child: Icon(
                      Icons.settings,
                      color: Colors.white,
                      size: 35,
                    )),onTap: ()=>Get.to(()=>AppSetingPage()),),
                Expanded(
                  child: Container(
                    child: GridView.builder(
                        itemCount: 4,
                        gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
                          crossAxisCount: 4,
                          crossAxisSpacing: 10,
                          mainAxisSpacing: 2,
                          childAspectRatio: 2 / 1,
                        ),
                        itemBuilder: (context, index) {
                          return GridTileBar(
                            title: Center(child: Text(state.myList[index])),
                            subtitle:
                                Center(child: Text(state.myListNumber[index])),
                          );
                        }),
                  ),
                )
              ],
            ),
          ),
        ),
      ),
    );
  }
}
